#! /usr/bin/python

import math

def isPrime(n):
    if n==2 or n==3 or n==5 or n==7: return True
    if n%2 == 0 or n%3 == 0 or n ==1: return False
    for i in range(5, int(math.sqrt(n) + 1), 6):
	if n%i == 0 or n%(i+2) == 0: return False
    return True

primes = set([2])
for i in range(1, 201, 2):
    if isPrime(i): primes.add(i)

def base2Mul(n):
    cc = int(math.log(n, 2))
    rest = n - 2**cc
    while(rest > 0):
	 p = int(math.log(rest, 2))
	 cc += 1
	 rest = rest - 2**p
    return cc

base2All = [0, 0]
for i in range(2, 201):
    base2All.append(base2Mul(i))

base2All[23] = 6
base2All[31] = 7
base2All[43] = 7
base2All[47] = 8
base2All[53] = 8
base2All[59] = 8
base2All[61] = 8
base2All[71] = 9
base2All[79] = 9
base2All[83] = 8
base2All[103] = 9
base2All[127] = 10
base2All[149] = 9
base2All[151] = 10
base2All[157] = 10
base2All[163] = 9
base2All[167] = 10
base2All[173] = 10
base2All[181] = 9
base2All[191] = 11      
base2All[199] = 10

for k in range(2, 101):
    for p in primes:
	n = k*p
	if n>200: break
	c = base2All[k] + base2All[p]
	if c < base2All[n]:
	   base2All[n] = c

print sum(base2All)

for p in primes:
    print p, base2All[p]
#print base2All[1:80]

